/*
 * @Descripttion: 患者预约医生，获取医生列表
 * @version: 1.0
 * @Author: 自由如风
 * @Date: 2021-05-04 20:45:15
 * @LastEditors: 自由如风
 * @LastEditTime: 2021-05-04 21:32:12
 */
const DB = require('../../lib/DB')
const { Success, Fail } = require('../../lib/Response')
const { DOCTOR } = require('../../lib/Identity')

module.exports = async function (ctx, nect) {
    try {
        const doctor = (await DB.models.user.findAll({ where: { Identity: DOCTOR }, attributes: ['name', 'memo', 'id'] })).map(e => e.toJSON())
        ctx.body = new Success(doctor)
    } catch (e) {
        ctx.body = new Fail(e.message)
    }
}